import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { GTextFormat } from "../../../common/GTextFormat";
import { BaseItem } from "../common/BaseItem";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { ItemData } from "../../resource/info/ItemData";
import { ItemConfig } from "../../resource/ItemConfig";
import { JSON } from "../../../../com/mui/serialization/json/JSON";
import { SceneConfig } from "../../resource/SceneConfig";
import { SPlayerItem } from "../../../../Message/Public/SPlayerItem";
type int = number;
//class WarehouseGoodsRenderer
    
    export  class WarehouseGoodsRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            this._blueTf = new GTextFormat("", 12, 11661311);
            this._item = new BaseItem();
            this._item.setSize(30, 30);
            this._item.move(10, 1);
            this._item.setAmountLabelPos(0, 16);
            addChild(this._item);
            this._goodsName = this.createTextfield(65, 5, 60, 20, "", this._blueTf);
            this._goodsNum = this.createTextfield(155, 5, 60, 20, "", this._blueTf);
            this._unitPriceBuy = this.createTextfield(235, 5, 60, 20, "", this._blueTf);
            this._placeBuy = this.createTextfield(300, 5, 60, 20, "", this._blueTf);
            var loc1=ObjCreate.createBg(0, 32, 365, 2, this, ImagesConst.SplitLine);
            return;
        }

        /* internal  */createTextfield(arg1: int, arg2: int, arg3: int, arg4: int, arg5: string, arg6: Object /* flash.text.TextFormat */): Object /* flash.text.TextField */
        {
            var loc1=null;
            (loc1 = new Object /* flash.text.TextField */()).x = arg1;
            loc1.y = arg2;
            loc1.width = arg3;
            loc1.height = arg4;
            loc1.text = arg5;
            loc1.selectable = false;
            loc1.mouseEnabled = false;
            loc1.setTextFormat(arg6);
            addChild(loc1);
            return loc1;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._sPlayerItem = (arg1 as ItemData).data;
            var loc1=new ItemData(this._sPlayerItem.itemCode);
            this._item.itemData = loc1;
            this._item.drawNow();
            this._item.amount = this._sPlayerItem.itemAmount;
            var loc2=ItemConfig.instance.getInfoByCode(loc1.itemCode).item.name;
            this._goodsName.text = loc2;
            this._goodsName.setTextFormat(this._blueTf);
            this._goodsNum.text = this._sPlayerItem.itemAmount.toString();
            this._goodsNum.setTextFormat(this._blueTf);
            var loc3;
            var loc4=(loc3 = JSON.deserialize(this._sPlayerItem.jsStr)).rb_buy;
            var loc5=loc3.rb_buy_map;
            this._unitPriceBuy.text = loc4.toString();
            this._unitPriceBuy.setTextFormat(this._blueTf);
            var loc6=SceneConfig.instance.getSceneInfo(loc5);
            this._placeBuy.text = loc6.sMapDefine.name;
            this._placeBuy.setTextFormat(this._blueTf);
            return;
        }

        /* internal */ /* var */_blueTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_item: BaseItem;

        /* internal */ /* var */_goodsName: Object /* flash.text.TextField */;

        /* internal */ /* var */_goodsNum: Object /* flash.text.TextField */;

        /* internal */ /* var */_unitPriceBuy: Object /* flash.text.TextField */;

        /* internal */ /* var */_placeBuy: Object /* flash.text.TextField */;

        /* internal */ /* var */_sPlayerItem: SPlayerItem;
    }
